from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
# 1.导入鼠标操作类
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Firefox()
driver.maximize_window()
url = 'file:///C:/Users/TEACHER/Desktop/NSD2405/html/registerA.html'
driver.get(url)
# 2.实例化鼠标操作对象
action = ActionChains(driver)
username = driver.find_element(By.CSS_SELECTOR, '#userA')
username.send_keys('admin')
sleep(3)
# 3.鼠标右击，传递定位的元素
# perform() 执行以上操作
action.context_click(username).perform()
# 双击操作
sleep(3)
action.double_click(username).perform()

# 停顿3秒后，在注册按钮上悬停
sleep(3)
button = driver.find_element(By.CSS_SELECTOR, 'button')
action.move_to_element(button).perform()

sleep(3)
driver.quit()